package com.abaaba.project2.controller;

import com.abaaba.project2.bean.GoodsDataSendingListBaseReq;
import com.abaaba.project2.bean.bo.AdminGoodsDeleteShoppingInformationBO;
import com.abaaba.project2.bean.vo.*;
import com.abaaba.project2.service.AdminCategoryService;
import com.abaaba.project2.service.AdminGoodsService;
import com.abaaba.project2.service.AdminOrderService;
import com.abaaba.project2.service.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
public class AdminIndexViewController {

    @Autowired
    AdminGoodsService adminGoodsService;
    @Autowired
    AdminUserService adminUserService;
    @Autowired
    AdminOrderService adminOrderService;
    @Autowired
    AdminCategoryService adminCategoryService;

    @RequestMapping("dashboard")
    public AdminIndexViewVO amdinIndexViewShowList(){
        // GoodsDataSendingListVO goodsDataSendingListVO = new GoodsDataSendingListVO();
        AdminIndexViewVO adminIndexViewVO = new AdminIndexViewVO();
        Long goodsCount = adminGoodsService.countSearchGoodsAll();
        Long userCount = adminUserService.countSearchUserAll();
        Long orderCount = adminOrderService.countSearchOrderAll();
        Long categoryCount = adminCategoryService.countSearchCategoryAll();
        AdminIndexViewVO.DataBean dataBean = new AdminIndexViewVO.DataBean(goodsCount,userCount,categoryCount,orderCount);

        adminIndexViewVO.setData(dataBean);
        adminIndexViewVO.setErrmsg("成功");
        adminIndexViewVO.setErrno(0);
        return adminIndexViewVO;
    }

}
